package com.goldsprite.gsgengine.gsgdxf;

import com.badlogic.gdx.ApplicationListener;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.InputMultiplexer;
import com.badlogic.gdx.InputProcessor;
import com.badlogic.gdx.utils.ScreenUtils;
import com.badlogic.gdx.utils.viewport.FitViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import com.goldsprite.gsgengine.core.GameLoop;
import com.goldsprite.gsgengine.core.managers.GameObjectManager;
import com.goldsprite.gsgengine.gsgdxf.screens.SceneManager;

public abstract class GameLauncher extends GameLoop implements ApplicationListener {
	private Viewport viewport;
	protected SceneManager sceneManager;
	protected GameObjectManager gameObjectManager;


	public final void create() {
		sceneManager = new SceneManager();
		viewport = sceneManager.getViewport();

		gameObjectManager = new GameObjectManager();
	}

	@Override
	public void start() {
		gameObjectManager.start();
	}

	@Override
	public void fixedUpdate(float fixedDelta) {
		gameObjectManager.fixedUpdate(fixedDelta);
	}

	@Override
	public void update(float delta) {
		gameObjectManager.update(delta);
	}

	@Override
	public void destroy() {
		gameObjectManager.destroy();
	}


	public final void dispose() {
		destroy();
	}

	public final void render() {
		ScreenUtils.clear(0.25f, 0.25f, 0.25f, 1.0f);
		float fixedDelta = 1/60f;
		float delta = Gdx.graphics.getDeltaTime();
		fixedUpdate(fixedDelta);
		update(delta);
	}

	public final void resize(int width, int height) {
		viewport.update(width, height, true);
	}

	public void pause() {}

	public void resume() {}

}
